import format from '@dfeidao/atom-web/dt/format';
import set from '@dfeidao/atom-web/global/set';
import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';
import show from '@dfeidao/atom-web/ui/show';

export default async function a001(fd: IFeidaoAiBrowserComponent,nos: string) {
	// todo
	const addtol=fd.data.node.querySelector<HTMLDivElement>('[data-id="updata"]');
	set_node_cls(addtol, 'display-n',false);
	show(fd.data.node);
	const ret = await nodejs<{dt: Array<{exam_name: string;start_time: number;
examination_category: string;exam_time: string;exam_score: string;exam_explain: string;
		finish_time: number}>}>('examination-management/zj-000003/s001',{
		exam_id:nos
	});
	set('nos',nos);
	const exam_name = fd.data.node.querySelector<HTMLInputElement>('[data-id="exam_name"]');
	const examination_category = fd.data.node.querySelector<HTMLInputElement>('[data-id="examination_category"]');
	const exam_score = fd.data.node.querySelector<HTMLInputElement>('[data-id="exam_score"]');
	const exam_time = fd.data.node.querySelector<HTMLInputElement>('[data-id="exam_time"]');
	const exam_explain = fd.data.node.querySelector<HTMLTextAreaElement>('[data-id="exam_explain"]');
	const start_time1 = fd.data.node.querySelector<HTMLInputElement>('[data-id="start_time"]');
	const finish_time1 = fd.data.node.querySelector<HTMLInputElement>('[data-id="finish_time"]');
	const finish_time = format(ret.dt[0].finish_time,2);
	const start_time = format(ret.dt[0].start_time,2);


	exam_explain.value = ret.dt[0].exam_explain;
	exam_name.value = ret.dt[0].exam_name;
	examination_category.value = ret.dt[0].examination_category;
	exam_score.value = ret.dt[0].exam_score;
	exam_time.value = ret.dt[0].exam_time;
	start_time1.value = start_time;
	finish_time1.value = finish_time;



}
